/**
 * 文章模块的数据请求
 */
import request from "@/utils/request"

export const GetArticlesList = params=>{
    return request({
        method:"get",
        url:"/v1_1/articles",
        params
    })
}

/**
 * 获取文章详情
 * @param {*} article_id 
 */
export const GetArticlesInfo = article_id => {
    return request({
        method: "get",
        url: `/v1_0/articles/${article_id}`
    })
}

/**
 * 收藏文章
 * @param {*} target  收藏文章的id
 */
export const AddCollectArticle = target=>{
    return request({
        method: "post",
        url: '/v1_0/article/collections',
        data:{
            target
        }
    })
}

/**
 * 取消收藏文章
 * @param {*} target  收藏文章的id
 */
export const DeleteCollectArticle = target => {
    return request({
        method: "delete",
        url: `/v1_0/article/collections/${target}`
    })
}


/**
 * 文章点赞
 * @param {*} target 
 */
export const AddLikingsArticle = target=>{
    return request({
        method: "post",
        url: '/v1_0/article/likings',
        data: {
            target
        }
    })
}

/**
 * 取消文章点赞
 * @param {*} target 
 */
export const DeleteLikingsArticle = target => {
    return request({
        method: "DELETE",
        url: `/v1_0/article/likings/${target}`
    })
}

